#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <linux/limits.h>

int main(int argc, char *argv[]) {
	    // 瀹氫箟涓€涓瓧绗︽暟缁勭敤浜庡瓨鍌ㄦ枃浠跺悕锛屾渶澶ч暱搴︿负PATH_MAX
	         char filename[PATH_MAX] = { 0 };
	    
	             // 妫€鏌ュ懡浠よ鍙傛暟鐨勬暟閲忥紝搴旇涓?锛堝寘鍚▼搴忓悕鍜屾枃浠跺悕锛?
	                 if (argc != 2) {
	                         fprintf(stderr, "You must supply a filename as an argument \n");
	                                 return 1;  // 杩斿洖1琛ㄧず閿欒
	                                     }
	    
	                                         // 灏嗗懡浠よ鍙傛暟涓殑鏂囦欢鍚嶆嫹璐濆埌filename鏁扮粍涓紝纭繚涓嶈秴杩嘝ATH_MAX-1
	                                             strncpy(filename, argv[1], PATH_MAX - 1);
	    
	                                                 // 鍒涘缓鏂囦欢锛屾潈闄愯缃负鍙鍙啓锛?644锛?
	                                                     if (creat(filename, 0644) == -1) {
	                                                             fprintf(stderr, "Can't create file %s \n", filename);
	                                                                     return 1;  // 杩斿洖1琛ㄧず閿欒
	                                                                         }
	    
	                                                                             return 0;  // 杩斿洖0琛ㄧず绋嬪簭鎵ц鎴愬姛
	                                                                             }
	    
